package com.xijing.view;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JFrame;
import javax.swing.JTextField;

public class DateTimePickerTest {
	/**
     * @param args
     */
    public static void main(String[] args) {
        JFrame jf = new JFrame("Date Picker Test");
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setLayout(null);
        jf.setBounds(400, 200, 400, 200);
        
        String fmt = "yyyy-MM-dd"; //2016-01-16
        //String fmt = "yyyy-MM-dd hh:mm:ss"; //2016-01-16 10:23:22
        SimpleDateFormat sdf = new SimpleDateFormat(fmt);
        DateTimePicker ser = DateTimePicker.getInstance(fmt);
        javax.swing.JTextField text = new JTextField();
        text.setBounds(10, 10, 200, 30);
        text.setText(sdf.format(new Date()));
        text.setEditable(false);
        ser.register(text);
        
        
        jf.add(text);
        jf.setVisible(true);
    }
}
